<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>罚款统计</title>
		<%include("/common/include.html"){}%>
		<link rel="stylesheet" href="${cxt!}/sb/plugins/ztree/css/zTreeStyle/zTreeStyle.css" type="text/css">
		<!-- <script src="${cxt !}/sb/js/fineRegistration/fineRegistration.js" type="text/javascript" charset="utf-8"></script> -->
		<style type="text/css">
		.textbox {
			padding-right: 0px;
			background: url("${cxt !}/sb/themes/insdep/images/combo_arrow.png")
				no-repeat scroll right center transparent;
		}
		</style>
	</head>
	<body class="easyui-layout">
			<div data-options="region:'north',split: true,title:'罚款统计'" style="height:150px;padding:10px;">
				<form id="fineInfoStatisticFrom" action="">
					<!-- <div style="margin-bottom: 10px;float:left;margin-right: 10px;height:30px;line-height:30px;">
						<label class="label-top" style="width: 30px; display: block;float:left;">年月</label>
						<input id = "month" name="_query.month" value='${date(),dateFormat="yyyy"}' class="easyui-datebox theme-textbox-radius" style="width:120px;height:25px;float:right;"  
						data-options="editable: false,icons:[{
		                        iconCls:'icon-clear',
		                        handler: function(e){
		                            $(e.data.target).datetimespinner('clear');
		                        }
		                    }]"/>
		                   
					</div>
							<div style="margin-bottom: 10px;float:left;margin-right: 10px;height:30px;line-height:30px;">
						<label class="label-top" style="width: 30px; display: block;float:left;">日</label>
						
						<input id="day" name="_query.day" value='${day !}'  class="easyui-numberspinner inputBox theme-textbox-radius"  style="width:120px;height:25px;float:right;"  data-options="increment:1,min:1,max:31,icons:[{
		                        iconCls:'icon-clear',
		                        handler: function(e){
		                            $(e.data.target).datetimespinner('clear');
		                        }
		                    }]""/>
		                    
					</div> -->
					
					<div style="margin-bottom: 10px;float:left;margin-right: 10px;height:30px;line-height:30px;">
						<label class="label-top" style="width: 30px; display: block;float:left;">机构</label>
						<input class="easyui-combobox" style="width:120px;height:25px;"  id="ORGAN" name="_query.ORGAN"
							data-options="
							url:'organization/getORGAN',
							method:'post',
							valueField:'ids',
							textField:'name'
							"> 
					</div>
					
					<div style="margin-bottom: 10px;float:left;margin-right: 10px;height:30px;line-height:30px;">
						<label class="label-top" style="width: 50px; display: block;float:left;">开始时间</label>
						<input id="BEGINTIME" name="_query.BEGINTIME"
						class="easyui-datetimebox inputBox theme-textbox-radius date"
						style="border: 1px solid black; width: 160px; height: 25px;" />
					</div>
					
					<div style="margin-bottom: 10px;float:left;margin-right: 10px;height:30px;line-height:30px;">
						<label class="label-top" style="width: 50px; display: block;float:left;">结束时间</label>
						<input id="ENDTIME" name="_query.ENDTIME"
						class="easyui-datetimebox inputBox theme-textbox-radius date"
						style="border: 1px solid black; width: 160px; height: 25px;" />
					</div>
					
					<div style="margin-bottom: 10px;float:left;margin-right: 10px;height:30px;line-height:30px;">
						<label class="label-top" style="width: 50px; display: block;float:left;">违法代码</label>
						<input class="easyui-combobox" style="width:120px;height:25px;"  id="WFDM" name="_query.WFDM"
							data-options="
							url:'penalties/getPenalties',
							method:'post',
							valueField:'code',
							textField:'codecontent'
							">
					</div>
					
					<div style="margin-bottom: 10px;float:left;margin-right: 10px;height:30px;line-height:30px;">
						<label class="label-top" style="width: 50px; display: block;float:left;">车辆类型</label>
						<select id="CLLX" name="_query.CLLX" style="width: 120px;height:25px;">
							<option value="">--请选择--</option>
							<option value="电动自行车">电动自行车</option>
							<option value="电动二轮车">电动二轮车</option>
							<option value="电动轮椅车">电动轮椅车</option>
							<option value="电动三轮车">电动三轮车</option>
							<option value="小型低速电动汽车">小型低速电动汽车</option>
						</select>
					</div>
					
					</br></br></br>
					
					
					<div style="margin-bottom: 10px;float:left;margin-right: 10px;height:30px;line-height:30px;">
						<label class="label-top" style="width: 50px; display: block;float:left;">缴纳状态</label>
						<select id="JNZT" name="_query.JNZT" style="width: 80px;height:25px;" >
							<option value="">--请选择--</option>
							<option value="已缴纳">已缴纳</option>
							<option value="未缴纳">未缴纳</option>
						</select>
					</div>
					<div>&nbsp;&nbsp;&nbsp;&nbsp;
						<a href="#" onclick='searchFrom()' class="easyui-linkbutton" data-options="iconCls:'icon-search'"style="width:80px;height:25px;margin-top:5px" >搜索</a>
						<a href="#" class="easyui-linkbutton" data-options="iconCls:'icon-clear'" style="width:80px;height:25px;margin-top:5px"  onclick="clearsj()">清除</a>
					</div>
					<input hidden="hidden" id="departmentids" value="${user.departmentids! }"></input>
					</form>
	   	 	</div>
	   	 	<div data-options="region:'center',border: false" style="overflow-x:hidden;">
				<table id="fineInfoTable" style="width:100%;height:100%;">
				</table>
	    	</div>
	    	
		<script type="text/javascript">
			
		var levelnum = "${organ.levelnum}";
		var ids = "${organ.ids}";
		$(document).ready(function () {
			
			if(levelnum == "3"){
				$("#ORGAN").combobox({'readonly': true});//设置下拉框为禁用 
				$("#ORGAN").combobox('setValue',ids);//菜单项可以text或者id
			}

			$("#LSH").combobox({
				onChange: function (n,o) {
					$("#HPHM").textbox("clear");
					$("#SFZMHM").textbox("clear");
					searchCus();
				}
			});
			$("#HPHM").combobox({
				onChange: function (n,o) {
					$("#LSH").textbox("clear");
					$("#SFZMHM").textbox("clear");
					searchCus();
				}
			});
			$("#SFZMHM").combobox({
				onChange: function (n,o) {
					$("#HPHM").textbox("clear");
					$("#LSH").textbox("clear");
					searchCus();
				}
			});

			var SFZMHM=$('#SFZMHM').val();
			var LSH=$('#LSH').val();
			var HPHM=$('#HPHM').val();
			
			if(SFZMHM==''&&LSH==''&&HPHM==''){
				return false;
			}
			searchCus();
		});

		//获取顾客信息
		function clearsj(){
			if(levelnum != "3"){
				$("#ORGAN").textbox("clear");
			}
			
			$("#BEGINTIME").textbox("clear");
			$("#ENDTIME").textbox("clear");
			$("#WFDM").textbox("clear");
			$("#CLLX").val('');
			$("#HPHM").textbox("clear");
			$("#LSH").textbox("clear");
			$("#SFZMHM").textbox("clear");
			$("#JNZT").val('');
		}


		//获取顾客信息
		function searchCus(){
			var SFZMHM=$('#SFZMHM').val();
			var LSH=$('#LSH').val();
			var HPHM=$('#HPHM').val();
			
			if(SFZMHM==''&&LSH==''&&HPHM==''){
				return false;
			}
			var url='/fineRegistration/getVInfo';
			var data={"sfzmhm":SFZMHM,"lsh":LSH,"hphm":HPHM};
			var reData = common_ajax.ajaxFunc(url,data,"json");
			if(reData.msg==200){
				$("#SFZMHM").textbox('setValue',reData.vehicle.sfzmhm);
				$("#LSH").textbox('setValue',reData.vehicle.lsh);
				$("#HPHM").textbox('setValue',reData.vehicle.hphm);
				$("#CLLX").val(reData.vehicle.cllx);
				return  reData;
			}
		}

		//格式化日期
		$.fn.datetimebox.defaults.formatter = function(date){
		    //显示格式: 2017-05-08 17(只显示年月日)
		    var year = date.getFullYear();
		    var month = date.getMonth() + 1;
		    var day = date.getDate();
		    month = month < 10 ? '0' + month : month;
		    day = day < 10 ? '0' + day : day;
		    return year + "-" + month + "-" + day;
		}

		function myformatter2(date){
		    var y = date.getFullYear();
		    var m = date.getMonth()+1;
		    var d = date.getDate();
		    return y+'-'+(m<10?('0'+m):m)+'-'+(d<10?('0'+d):d);
		}
		$(function () {
		    var curr_time = new Date();
		    $("#ENDTIME").datebox("setValue",myformatter2(curr_time));
		})
		
			var $form = $('#fineInfoStatisticFrom');
			function searchFrom(){
				initFineInfoTable();
			}
			var columns = [[
					  		{field:'total_count',title:'违法车辆总数',width:100,align:'center'},
					  		{field:'total_money',title:'罚金总额(元)',width:200,align:'center'},
					      ]];
			function initFineInfoTable(){
				$('#fineInfoTable').datagrid({
					cls: "theme-datagrid",
					toolbar: '#tb',
					singleSelect: true,
					rownumbers: true, //显示序号
					pagination: true,
					pageSize: 10,
					url: "${cxt!}/fineStatistic/statisticlist",
					queryParams: sy.serializeObject($form),
				    method: 'post',
					collapsible: true,
					remoteSort:false,
					multiSort:true,
					columns:columns,
					onLoadSuccess:function(){
						$('#fineInfoTable').datagrid("selectRow", 0);
						// 获取主表选中行
					},
					onClickRow:function(rowIndex,rowData){
					}
				});
			}
	
		</script>
	</body>
</html>
